<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
</head>
<body>
    <form action="index.php" method="get">
        <h2>个人资料</h2>
        <hr />
        姓名：
        <br />
        <input type="text" name="username">
        <br />
        特长：
        <br />
        <input type="text" name="merit">
        <br />
        性别：
        <br />
        <input type="radio" name="sex" id="boy" onchange="ongender()">男
        <input type="radio" name="sex" id="girl" onchange="ongender()">女
        <a id="xb"></a>
        <br />
        公司：
        <br />
        <input type="text" name="company">
        <br />
        职务：
        <br />
        <input type="text" name="duty">
        <br />
        微信：
        <br />
        <input type="text" name="wechat">
        <br />
        QQ：
        <br />
        <input type="text" name="qq">
        <br />
        所在地：
        <br />
        <select name="provincename" id="provinceid" onchange="selectprovince()">

        </select>
        <select name="cityname" id="cityid">
            <option value ="-1">请选择城市</option>
        </select>
        <br />
        自我介绍：
        <br />
        <textarea rows="8" cols="100" name="introduce"></textarea>
        <br />
        <input type="submit" id="" value="更新" />
    </form>
</body>
    <script>
        var provinces = ['北京','上海','福建'];
        var citys = [
            ['海淀','朝阳'],
            ['陆家嘴','浦东'],
            ['龙岩','宁德','三明','泉州','厦门','南平','福州','漳州','莆田']
        ];
        function selectprovince(){
            var provinceidobj = document.getElementById('provinceid');
            var provinceindex = provinceidobj.value;
            var cityidobj = document.getElementById('cityid');
            cityidobj.innerHTML = '<option value="-1">请选择城市</option>';
            if(provinceindex != -1){
                var currentcitys = citys[provinceindex];
                for(var i=0 ; i<currentcitys.length ; i++){
                    cityidobj.innerHTML += '<option value="'+i+'">'+currentcitys[i]+'</option>';
                }
            }
        }
        function ongender(){
            var b = document.getElementById('boy').checked;
            var g = document.getElementById('girl').checked;
            if(b==true){
                var gender = '男';
            }else if(g == true){
                var gender = '女';
            }
            var xbobj = document.getElementById('xb');
            xbobj.name = gender ;
        }
        onload = function(){
            var provinceidobj = document.getElementById('provinceid');
            provinceidobj.innerHTML = '<option value="-1">请选择省份</option>';
            for(var i=0 ; i<provinces.length ; i++){
                provinceidobj.innerHTML += '<option value="'+i+'">'+provinces[i]+'</option>';
            }
        }
    </script>
</html>